<?php
/**
 * Created by PhpStorm.
 * User: sunshine
 * Date: 2016/8/31
 * Time: 8:40
 */
require_once "Admin/Controller/Controller.php";
require_once "Admin/Model/S_testModel.php";

class S_testController extends Controller
{function __Construct(){
    parent::__Construct();

}

    function testlist(){
        if (isset($_SESSION['admin'])) {
            $model = new S_testModel();
            $data = $model->getTestList();
            $this->assign('test', $data);
            $this->display();
        }
    }
    function form(){
        if (isset($_SESSION['admin']))
        $this->display();
    }
    function add(){
        if (isset($_SESSION['admin'])){
        $data=$_POST;
       // var_dump($data);
        $model = new S_testModel();
        $result = $model->addTest($data);
       if($result){
            echo '添加成功 <a href="admin.php?c=s_test&m=testlist">如果没有跳转，请点这里跳转</a>';
           // header("refresh:3;url='admin.php?c=S_test&m=S_testlist'");
        }
        else{
            echo "添加失败！<br/>";
          //  header("refresh:3;url='admin.php?c=S_test&m=S_testlist'");
        }
    }}
}
?>
